using UpdateControls;

namespace Core.Domain.Bases
{
  ///<summary>Make an UpdateControl with an inner value of type T</summary>
  ///<typeparam name="T"></typeparam>
  public class IndependentWrapper<T>
  {
    private T _inner;
    private Independent _independent = new Independent();

/*
    This is nice, but only works in one direction, and only for simple T (not nested generics)    
 * ///<summary></summary>
    ///<param name="x"></param>
    ///<returns></returns>
    public static implicit operator T(IndependentWrapper<T> x)
    {
      return x.Value;
    }
*/

    
    ///<summary>Access t othe inner value</summary>
    public T Value
    {
      get
      {
        _independent.OnGet();
        return _inner;
      }
      set { 
        _independent.OnSet();
        _inner = value; 
      }
    }
  }
}